package org.yagnus.calendar;

import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * A repeated schedule is an object that represents what you see in a calendar
 * when you schedule a repeated event. Some variants include:
 * 
 * <pre>
 * * daily 
 * * 3rd day of each week 
 * * same day every year. 
 * * etc.
 * </pre>
 * 
 * This interface represents operations on repeated scheduler
 * 
 * @author hc.busy
 * 
 */
public interface CalendarDaySchedule {

	/**
	 * Happens on returns true if this schedule triggers on the day specified
	 * 
	 * @param day
	 * @return whether or not the schedule should trigger on the specified day
	 */
	public boolean happensOn(Calendar day);

	public boolean happensOn(Date day);

	public boolean happensOn(long day);

	/**
	 * 
	 * Calculates the days this schedule triggers on during the specified
	 * period. it includes all days starting at start and upto but not encluding
	 * the end day.
	 * 
	 * @param start
	 * @param end
	 * @return returns the dates this schedule triggers on.
	 */
	public List<Date> daysDuring(Calendar start, Calendar end);

	public List<Date> daysDuring(Date start, Date end);

	public List<Date> daysDuring(long start, long end);

	/**
	 * Returns one single date strictly after the starting day in the parameter
	 * on which the event occur
	 * 
	 * Note: this method may run for a very long time, a safer way is to call
	 * daysDuring and specify a large end date.
	 * 
	 * @param start
	 * @return next time it happens
	 */
	public Date nextTime(Calendar start);

	public Date nextTime(Date start);

	public Date nextTime(long start);

}
